<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="ctx" value="${pageContext.request.contextPath}"></c:set>  
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>商品查找</title>
    <link href="${ctx}/dist/bootstrap-3.3.7-dist/css/bootstrap.min.css" rel="stylesheet">
</head>

<body>
    <div style="margin:20px;">
            <!-- 多条件查询 -->
        <form action="${ctx}/GoodsServlet/findGoodsByChoose">
            <div style="height:50px;width:100%;">
                <div style="float:right;width:900px;margin-top:10px;">
                    <h3 style="float:left;margin:0px;"><span class="label label-default">选择查找条件：</span></h3>
                    <div style="width:150px;float: left;margin-left:10px;">
                        <select class="form-control" name="choose">
                            <option value="goods_id">编号</option>
                            <option value="goods_classification">商品分类</option>
                            <option value="goods_name">名称</option>
                        </select>
                    </div>
                    <h3 style="float:left;margin:0px;margin-left:20px;"><span class="label label-default">输入查找值：</span></h3>
                    <div style="width:150px;float: left;margin-left:10px;margin-top:2px;"><input type="text" name="values"/></div>
                    <div style="width:150px;float: left;margin-left:30px;margin-top:2px;"><input type="submit" name="chaxun" value="查找"/></div>
                </div>
            </div>
        </form>
            <!-- 多条件查询结束 -->
        <div class="panel panel-warning text-center" style="height:400px;">
            <div class="panel-heading">
                <h3 class="panel-title">商品列表</h3>
            </div>
            <table class="table table-hover table-bordered table-striped">
                <tr>
                    <td>商品编号</td>
                    <td>商品名称</td>
                    <td>商品分类</td>
                    <td>单价</td>
                    <td>规格</td>
                    <td>产地</td>
                    <td>介绍</td>
                    <td>备注</td>
                </tr>
                <c:forEach var="goodslist" items="${goodslist}">
                	<tr>
                   	 	<td>${goodslist.goods_id}</td>
                        <td>${goodslist.goods_name}</td>
                        <td>${goodslist.goods_classification}</td>
                        <td>${goodslist.price}</td>
                        <td>${goodslist.unit}</td>
                        <td>${goodslist.origin}</td>
                        <td>${goodslist.introduce}</td> 
                        <td>${goodslist.remark}</td>
                	</tr>
                </c:forEach>
            </table>
        </div>
        <div id="pagination" style="float: right;"></div>
    </div>

</body>
<script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="${ctx}/dist/jquery-bootstrap-pagination/jquery-bootstrap-pagination.js"></script>

<script>
    $("#pagination").pagination({
               total_pages:${pageCount},
              current_page: ${pageNum},
              prev: "上一页",
              next: "下一页",
              callback: function(event, page) {
            	  location="${ctx}/GoodsServlet/findGoods?pageNum="+page;
            }
          });  
</script>
</html>